
module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable('mooc_user', {
      id: {
        type: Sequelize.UUID,
        allowNull: false,
        primaryKey: true,
        defaultValue: Sequelize.UUIDV1,
        comment: '主键 唯一标识'
      },
      username: {
        type: Sequelize.STRING(32),
        comment: '用户名'
      },
      nickname: {
        type: Sequelize.STRING(32),
        comment: '昵称'
      },
      head_icon: {
        type: Sequelize.STRING(255),
        comment: '头像'
      },
      password: {
        type: Sequelize.STRING(64),
        comment: '密码'
      },
      phone: {
        type: Sequelize.STRING(32),
        comment: '手机号'
      },
      email: {
        type: Sequelize.STRING(64),
        comment: '邮箱'
      },
      identify: {
        type: Sequelize.STRING(12),
        comment: '用户身份'
      },
      signature: {
        type: Sequelize.TEXT,
        comment: '签名'
      },
      status: {
        type: Sequelize.STRING(1),
        comment: '用户状态'
      },
      create_time: {
        type: Sequelize.DATE,
        comment: '创建日期'
      },
      create_user: {
        type: Sequelize.UUID,
        comment: '创建用户'
      },
      last_time: {
        type: Sequelize.DATE,
        comment: '修改日期'
      },
      last_user: {
        type: Sequelize.UUID,
        comment: '修改用户'
      },
      delete_flag: {
        type: Sequelize.BOOLEAN,
        comment: '是否删除（1是，0否）',
        allowNull: false,
        defaultValue: false
      }
    })
  },
  down: queryInterface => {
    return queryInterface.dropTable('mooc_user')
  }
}
